<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;

/**
 * Class Cart
 * 
 * @property int $id
 * @property int $uid
 * @property int $goods_id
 * @property int|null $attribute_id
 * @property int|null $count
 * @property bool|null $status
 * @property Carbon|null $create_at
 * @property Carbon|null $update_at
 * @property Carbon|null $delete_at
 *
 * @package App\Models
 */
class Cart extends BaseModels
{
	protected $table = 'zh_cart';

	protected $casts = [
		'uid' => 'int',
		'goods_id' => 'int',
		'attribute_id' => 'int',
		'count' => 'int',
		'status' => 'bool'
	];

	protected $dates = [
		'create_at',
		'update_at',
		'delete_at'
	];

	protected $fillable = [
		'uid',
		'goods_id',
		'attribute_id',
		'count',
		'status',
		'create_at',
		'update_at',
		'delete_at'
	];


	public function goods()
    {
        return $this->hasOne(Good::class,'id','goods_id');
    }

    public function goodsAttribute()
    {
        return $this->hasOne(GoodsSkuAttribute::class,'id','attribute_id');
    }
}
